begin tran
select top 100 * from pos_vip_info where shop_code = 'gztgh'

declare @i int 
select @i = convert(int, var_data) 
from igs_parm with(updlock) where var_name = 'gv_upd_id'

	insert into pos_vip_info(vip_no, chs_firstname,chs_lastname,birth_year,birth_month,birth_day,mobile_no,id_no,
	sex,expiry_year,expiry_month,effect_year,effect_month,status,shop_code,comp_code,vip_type, upd_id)
	select distinct vip_no, chs_firstname,chs_lastname,birth_year,birth_month,birth_day,mobile_no,id_no,
	case when sex = N'Ů' then 'F' else 'M' end,expiry_year,expiry_month,effect_year,effect_month,status,shop_code,comp_code,vip_type, @i
	from cqbj_vip

rollback tran

select * from pos_vip_type
	select * from ms_emp where emp_no = 'KOCQ0102'

	select * from pos_shop where shop_code = 'cqjb'

	select  mobile_no from cqbj_vip group by mobile_no having count(*) > 1

